R Markdown


1.GRAPH

2.LINEGRAPH

g1 = plot_ly(data_avg, x = ~date, y = ~new_case_mean, color = ~county_names, type = "scatter", mode = "lines")
g2 = ggplot(data_avg, aes(x = date, y = pcr_target_mean, color = county_names)) +
          geom_line() + geom_point(size = .5, alpha = 0.5)
g2_plotly <- ggplotly(g2)
subplot(g1, g2_plotly)

3.BARGRAPH

p <- ggplot(county_avg, aes(x=new_case_mean, 
                     y=pcr_target_mean, 
                     color=county_names)) +
  geom_point(size=3) +
  labs(x = "new cases in each county",
       y = "virus copy number in wastewater",
       color = "county names in California") +
  theme_bw()

ggplotly(p)

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Copyright © 2020, Abigail Horn.